public with sharing class Cald_EditPlanEligibilityVF {

    private final Callidus_Plan__c[] plan = new Callidus_Plan__c[1];
    private Callidus_Plan__c[] planObj = null;
    public String byRoleTitle {get; set;}
    public boolean roleDisabled {get; set;}
    public boolean titleDisabled {get; set;}
    public boolean showAddTitle {get; set;}
    public boolean showAddRole {get; set;}
    public String roleTitleValue {get; set;}
    
    public Integer removeEligibilityRow {get; set;}
    
    private Integer roleCount {get; set;}
    private Integer titleCount {get; set;}
    
    public List<Callidus_Plan_Assignable__c> participantsList {get; set;}
    public Callidus_Plan_Role__c[] planRoleList = new Callidus_Plan_Role__c[]{};
    
    public Callidus_Plan_Assignable__c pa {get; set;}
    private List<String> userTitleList = null;
    private Map<ID, UserRole> userRoleMap = null;
    private Map<ID, ID> planRoleMap = new Map<ID, ID>();
    private Map<ID, Callidus_Plan_Assignable__c> checkParticipantsMap = new Map<ID, Callidus_Plan_Assignable__c>(); 
    
    public List<RoleWrapper> rolesList = new List<RoleWrapper>();
    private List<RoleWrapper> rolesDupList = new List<RoleWrapper>();
    public List<TitleWrapper> titlesList = new List<TitleWrapper>();
    private List<TitleWrapper> titlesDupList = new List<TitleWrapper>();

    public Cald_EditPlanEligibilityVF(ApexPages.StandardController myController)
    {
        this.plan[0] = (Callidus_Plan__c)myController.getRecord();
        byRoleTitle = 'byTitle';
        showAddTitle = true;
        showAddRole = false;
        roleDisabled = titleDisabled = false;
        roleCount = titleCount = 0;
        participantsList = null;
        setUserRoles();
        planObj = [select Id, Quota__c, Type__c, Start_Date__c, End_Date__c from Callidus_Plan__c where id = :plan[0].id];
        
        if(planObj.size() > 0 && planObj[0].Type__c == 'Role')
        {
            byRoleTitle = 'byRole';
            roleTitleValue = 'Role';
        }
            
        planRoleList = [select id, RoleId__c, RoleTitle__c, Description__c from Callidus_Plan_Role__c where plan__c = :plan[0].id];
        for(Callidus_Plan_Role__c pr: planRoleList)
        {
            planRoleMap.put(pr.ID, pr.ID);  
        }
        
        if(planRoleList.size() > 0 && byRoleTitle == 'byTitle')
        {
            roleDisabled = !roleDisabled;
            roleTitleValue = 'Title';
            for(Callidus_Plan_Role__c pr: planRoleList)
            {
                TitleWrapper t = new TitleWrapper(titleCount++);
                t.selectedTitle = pr.RoleTitle__c;
                titlesList.add(t);  
            }
        }        
        else if(planRoleList.size() > 0 && byRoleTitle == 'byRole')
        {
            titleDisabled = !titleDisabled;
            showAddRole = !showAddRole;
            showAddTitle = !showAddTitle;
            roleTitleValue = 'Role';
            for(Callidus_Plan_Role__c pr: planRoleList)
            {
                RoleWrapper r = new RoleWrapper(roleCount++);
                r.selectedRole = pr.RoleId__c;
                rolesList.add(r);   
            }
        }        
        else
        {
            titlesList.add(new TitleWrapper(titleCount++));
            titlesList.add(new TitleWrapper(titleCount++));
            titlesList.add(new TitleWrapper(titleCount++));
            titlesList.add(new TitleWrapper(titleCount++));
            titlesList.add(new TitleWrapper(titleCount++));
            roleTitleValue = 'Title';
        }
        
        participantsList = [select Participant__c, Participant__r.Name, Role_ID__c, Role_Title__c, Effective_Start_Date__c, Effective_End_Date__c, Quota__c from Callidus_Plan_Assignable__c where Plan_Role__c in :planRoleMap.keySet() limit 1000];
        for(Callidus_Plan_Assignable__c pa: participantsList)
        {
            checkParticipantsMap.put(pa.Participant__c, pa);
        }
        
        if(participantsList.size() == 0)
            participantsList = null;
    }//end of Constructor
    
    public void setUserRoles()
    {
        userRoleMap = new Map<ID, UserRole>();
        for(UserRole[] uRoleList: [select Id, Name, Rollupdescription from UserRole order by Name])
        {
            for(UserRole ur: uRoleList)
                userRoleMap.put(ur.id, ur);
            if(userRoleMap.size() >= 1000)
                break;
        }
    }

    public PageReference addEligibility()
    {
        if(byRoleTitle == 'byTitle')
            titlesList.add(new TitleWrapper(titleCount++));
        else 
            rolesList.add(new RoleWrapper(roleCount++));
        return null;
    }    

    public PageReference saveEligibility()
    {
        try
        {
            for(Callidus_Plan_Assignable__c pa: participantsList)
            {
                if(pa.Effective_Start_Date__c < planObj[0].Start_Date__c)
                {
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info, ''+pa.Participant__r.Name+'\'s Effective Start Date should be >= Plan\'s Effective Start Date - '+planObj[0].Start_Date__c.month()+'/'+planObj[0].Start_Date__c.day()+'/'+planObj[0].Start_Date__c.year()));
                    return null;
                }
                if(pa.Effective_End_Date__c != null && pa.Effective_End_Date__c > planObj[0].End_Date__c)
                {
                    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info, ''+pa.Participant__r.Name+'\'s Effective End Date should be <= Plan\'s Effective End Date - '+planObj[0].End_Date__c.month()+'/'+planObj[0].End_Date__c.day()+'/'+planObj[0].End_Date__c.year()));
                    return null;
                }
            }
            
            planRoleList.clear();
            Map<Id, Id> deletedPlanRoles = new Map<Id, Id>();
            for(Callidus_Plan_Role__c[] pRole: [select id from Callidus_Plan_Role__c where plan__c = :plan[0].id])
            {
                for(Callidus_Plan_Role__c pr: pRole)
                    deletedPlanRoles.put(pr.id, pr.id);

                for(Callidus_Plan_Assignable__c[] pAssignable: [select id from Callidus_Plan_Assignable__c where plan_role__c in :deletedPlanRoles.keyset()])
                    delete pAssignable;
                deletedPlanRoles.clear();
                delete pRole;
            }

            
            if(byRoleTitle == 'byRole')
            {
                Map<ID, ID> tempMap = new Map<ID, ID>();
                for(RoleWrapper rw: rolesList)
                {
                    tempMap.put(rw.selectedRole, rw.selectedRole);
                }
                if(planObj.size() > 0)
                {
                    planObj[0].Type__c = 'Role';
                    update planObj;
                }
                
                if(tempMap.size() > 0)
                {
                    List<String> selectedRoleList = tempMap.values();
                    Callidus_Plan_Role__c planRole = null;
                    UserRole ur = null;
                    for(ID roleId : selectedRoleList)
                    {
                        if((ur = userRoleMap.get(roleId)) != null)
                        {
                            planRole = new Callidus_Plan_Role__c(RoleID__c = roleId, plan__c = planObj[0].Id, RoleTitle__c = ur.Name, Description__c = ur.RollupDescription);
                            planRoleList.add(planRole);
                        }
                    }
                    if(planRoleList.size() > 0)
                        insert planRoleList;

                    if(participantsList != null)
                        for(Callidus_Plan_Role__c pr: planRoleList)
                            for(Callidus_Plan_Assignable__c pa: participantsList)
                                if(pr.RoleID__c == pa.Role_ID__c)
                                    pa.Plan_Role__c = pr.id;
                    
                }           
                    
            }
            else
            {
                Map<String, String> tempMap = new Map<String, String>();
                for(TitleWrapper tw: titlesList)
                {
                    //if(tw.selectedTitle != 'select')
                        tempMap.put(tw.selectedTitle, tw.selectedTitle);
                }
                
                if(tempMap.size() > 0)
                {
                    List<String> selectedTitleList = tempMap.values();
                    Callidus_Plan_Role__c planRole = null;
                    for(String title : selectedTitleList)
                    {
                        planRole = new Callidus_Plan_Role__c(plan__c = planObj[0].Id, RoleTitle__c = title);
                        planRoleList.add(planRole);
                    }
                    if(planRoleList.size() > 0)
                        insert planRoleList;

                    if(participantsList != null)
                        for(Callidus_Plan_Role__c pr: planRoleList)
                            for(Callidus_Plan_Assignable__c pa: participantsList)
                                if(pr.RoleTitle__c == pa.Role_Title__c)
                                    pa.Plan_Role__c = pr.id;
                }           
                if(planRoleList.size() > 0 && planObj.size() > 0)
                {
                    planObj[0].Type__c = 'Title';
                    update planObj;
                }
                
            }

            if(planRoleList.size() == 0)
            {
                planObj[0].Type__c = '';
                update planObj;
            }
            
            
            if(planRoleList.size() > 0 && participantsList != null && participantsList.size() > 0 && participantsList[0].Id == null)
                insert participantsList;
            else if(planRoleList.size() > 0 && participantsList != null && participantsList.size() > 0) 
            {
                List<Callidus_Plan_Assignable__c> dupParticpantsList = new List<Callidus_Plan_Assignable__c>();
                dupParticpantsList = participantsList.deepClone();
                participantsList.clear();
                for(Callidus_Plan_Assignable__c p: dupParticpantsList)
                {
                    Callidus_Plan_Assignable__c pa = new Callidus_Plan_Assignable__c(Plan__c = plan[0].id, Participant__c = p.Participant__c, Role_ID__c = p.Role_ID__c, Role_Title__c = p.Role_Title__c, Plan_Role__c = p.Plan_Role__c, Effective_Start_Date__c = p.Effective_Start_Date__c, Effective_End_Date__c = p.Effective_End_Date__c, Quota__c = p.Quota__c);
                    participantsList.add(pa);
                }
                insert participantsList;    
            }
        }
        catch(Exception e)
        {
            if(e.getMessage().contains('ENTITY_IS_DELETED'))
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info, 'Please update the Participants first and then save.'));
            else 
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info, e.getMessage()));
        }
        return null;
    }    

    public PageReference cancelEligibility()
    {
        return null;
    }    
    
    public PageReference updateParticipants()
    {
        try
        {
            if(rolesList.size() == 0 && titlesList.size() == 0)
            {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info, 'Please define Eligibility and update the Participants.'));
                return null;
            }   
                
            Map<String, String> roleTitleMap = new Map<String, String>();
            if(participantsList != null)
                participantsList.clear();
            else
                participantsList = new Callidus_Plan_Assignable__c[]{};
                
            Callidus_Plan_Role__c[] pRoleList = [select Id, RoleID__c from Callidus_Plan_Role__c where Plan__c = :plan[0].id];
            User[] usersList = null;
            if(byRoleTitle == 'byTitle')
            {
                roleTitleValue = 'Title';
                
                for(TitleWrapper tw: titlesList)
                    roleTitleMap.put(tw.selectedTitle, tw.selectedTitle);
                usersList = [select Id, Name, User.UserRole.Name, UserRoleId, User.Title from User u where u.Title in :roleTitleMap.keyset() limit 1000];
            }
            else
            {
                roleTitleValue = 'Role';
                for(RoleWrapper rw: rolesList)
                    roleTitleMap.put(rw.selectedRole, rw.selectedRole);
                usersList = [select Id, Name, User.UserRole.Name, User.Title, UserRoleId from User u where u.UserRoleId in :roleTitleMap.keySet() limit 1000];
            }
            
            for(User u: usersList)
            {
                if(checkParticipantsMap.get(u.Id) == null)
                {
                    Callidus_Plan_Assignable__c pa = null;
                    if(byRoleTitle == 'byRole')
                    {
                        pa = new Callidus_Plan_Assignable__c(Plan__c = plan[0].id, Participant__c = u.Id, Participant__r = u, Role_ID__c = u.UserRoleId, Role_Title__c = u.UserRole.Name, Effective_Start_Date__c = planObj[0].Start_Date__c, Effective_End_Date__c = planObj[0].End_Date__c, Quota__c = planObj[0].Quota__c);
                    }
                    else
                    {
                        pa = new Callidus_Plan_Assignable__c(Plan__c = plan[0].id, Participant__c = u.Id, Participant__r = u,  Role_ID__c = u.UserRoleId, Role_Title__c = u.Title, Effective_Start_Date__c = planObj[0].Start_Date__c, Effective_End_Date__c = planObj[0].End_Date__c, Quota__c = planObj[0].Quota__c);
                    }
                    
                    participantsList.add(pa);
                    checkParticipantsMap.put(u.Id, pa);
                }
                else
                {
/*                  if(roleDisabled == false && titleDisabled == false)
                    {
                    }*/
                    Callidus_Plan_Assignable__c cpa = checkParticipantsMap.get(u.Id);
                    if(byRoleTitle == 'byRole')
                    {
                        cpa.Role_Title__c = u.UserRole.Name;
                    }
                    else
                        cpa.Role_Title__c = u.Title;
                    checkParticipantsMap.put(u.Id, cpa);
                    participantsList.add(cpa);
                }
                
            }
            
            //Start : Remove all the Particpants whose Roles or Titles have been removed 
            List<Callidus_Plan_Assignable__c> assignedParticipantsList = checkParticipantsMap.values();
            Boolean checkRemoveFlag = false;
            for(Callidus_Plan_Assignable__c participant : assignedParticipantsList)
            {
                checkRemoveFlag = false;
                for(Callidus_Plan_Assignable__c pa : participantsList)
                {
                    if(pa.Participant__c == participant.Participant__c)
                    {
                        checkRemoveFlag = !checkRemoveFlag;
                        break;
                    }
                }
                if(!checkRemoveFlag)
                    checkParticipantsMap.remove(participant.Participant__c);    
            }
            //End : Remove all the Particpants whose Roles or Titles have been removed
            
            if(participantsList != null && participantsList.size() == 0)
                participantsList = null;
            
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.info, e.getMessage()));
        }
        
        return null;
    }

    public PageReference removeEligibility()
    {
        try
        {
            Integer count = 0;
            
            if(byRoleTitle == 'byRole' && rolesList.size() > 0)
            {
                for(RoleWrapper rw: rolesList)
                {
                    if(rw.roleNumber == removeEligibilityRow)
                    {
                        rolesList.remove(count);
                        break;
                    }
                    count++;
                }
            }
            else if(titlesList.size() > 0)
            {
                for(TitleWrapper tw: titlesList)
                {
                    if(tw.titleNumber == removeEligibilityRow)
                    {
                        titlesList.remove(count);
                        break;
                    }
                    count++;
                }
            }
            
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, e.getMessage()));
        }
        return null;
    }    

    public PageReference checkSelection()
    {
        try
        {
            showAddRole = !showAddRole;
            showAddTitle = !showAddTitle;
            if(byRoleTitle == 'byTitle')
            {
                roleTitleValue = 'Title';
                
                for(RoleWrapper ur: rolesList)
                    rolesDupList.add(ur);
                rolesList.clear();
                if(titlesDupList.size() > 0)
                {
                    for(TitleWrapper u: titlesDupList)
                        titlesList.add(u);
                    titlesDupList.clear();
                }
                
            }
            else
            {
                for(TitleWrapper u: titlesList)
                    titlesDupList.add(u);
                titlesList.clear();
    
                roleTitleValue = 'Role';
                if(rolesDupList.size() == 0 && rolesList.size() == 0)
                {
                    rolesList.add(new RoleWrapper(roleCount++));
                    rolesList.add(new RoleWrapper(roleCount++));
                    rolesList.add(new RoleWrapper(roleCount++));
                    rolesList.add(new RoleWrapper(roleCount++));
                    rolesList.add(new RoleWrapper(roleCount++));
                }
                
                if(rolesDupList.size() > 0)
                {
                    for(RoleWrapper ur: rolesDupList)
                        rolesList.add(ur);
                    rolesDupList.clear();
                }
            }
            
            participantsList = null;
        }
        catch(Exception e)
        {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.info, e.getMessage()));
        }
        return null;
    }    
    
    public class RoleWrapper 
    {
        public ID selectedRole {get; set;}
        public Integer roleNumber {get; set;}

        public RoleWrapper(Integer roleNumber)
        {
            this.roleNumber = roleNumber;
        }

        public List<SelectOption> getRoles() 
        {
            List<SelectOption> options = new List<SelectOption>();
            
            //options.add(new SelectOption('select', 'Select'));
            for(UserRole[] uRoleList: [select Id, Name from UserRole order by Name])
            {
                for(UserRole ur: uRoleList)
                    options.add(new SelectOption(ur.Id, ur.Name));
                if(options.size() >= 1000)
                    break;
            }
            return options; 
        }
    }
    
    public List<RoleWrapper> getRoleRows() {
        return rolesList;
    }

    public class TitleWrapper 
    {
        public String selectedTitle {get; set;}
        public Integer titleNumber {get; set;}

        
        public titleWrapper(Integer titleNumber)
        {
            this.titleNumber = titleNumber;
        }
        
        public List<SelectOption> getTitles() 
        {
            List<SelectOption> options = new List<SelectOption>();
            
            //options.add(new SelectOption('select', 'Select'));
            Map<String, String> tempUserMap = new Map<String, String>(); 
            for(User[] usersList: [select Title from User where Title != ''])
            {
                for(User u: usersList)
                    tempUserMap.put(u.Title, u.Title);
                if(tempUserMap.size() >= 1000)
                    break;
            }
            List<String> titlesList = tempUserMap.values();
            
            for(String s: titlesList)
                options.add(new SelectOption(s, s));

            return options; 
        }
    }
    
    public List<TitleWrapper> getTitleRows() {
        return titlesList;
    }
    
    Boolean displayAssignedToFlag = false;
    public String changeTC()
    {
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;      
        displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag = displayAssignedToFlag;
        return 'success';      
    }
    
    static testMethod void testCald_EditPlanEligibilityVF()
    {
        PageReference pg = Page.Cald_Edit_Plan_Eligibility;
        Test.setCurrentPage(pg);
        Test.startTest();
        Callidus_Plan__c planObj = new Callidus_Plan__c(Name = 'Test', Start_Date__c = Date.today(), End_Date__c = (Date.today() + 100), Quota__c = 1000000, Type__c = 'Role');
        insert planObj;
		List<Callidus_Plan__c> tPlan = [select Name from Callidus_Plan__c where id = :planObj.id];
		for(Callidus_Plan__c p:tPlan)
		{
			System.assertEquals('Test', p.Name);
		}

        Callidus_Plan_Role__c pr = new Callidus_Plan_Role__c(plan__c = planObj.id, RoleId__c = UserInfo.getUserRoleId());
        insert pr;
		List<Callidus_Plan_Role__c> tPlanRole = [select Plan__c from Callidus_Plan_Role__c where id = :pr.id];
		for(Callidus_Plan_Role__c p:tPlanRole)
		{
			System.assertEquals(planObj.id, p.Plan__c);
		}
        
        Callidus_Plan_Assignable__c pa = new Callidus_Plan_Assignable__c(Plan__c = planObj.id, Participant__c = UserInfo.getUserId(), Role_ID__c = UserInfo.getUserRoleId(), Effective_Start_Date__c = (planObj.Start_Date__c + 5), Effective_End_Date__c = (planObj.End_Date__c - 5), Plan_Role__c = pr.id);
        insert pa;
		List<Callidus_Plan_Assignable__c> tPlanAssign = [select Plan__c from Callidus_Plan_Assignable__c where id = :pa.id];
		for(Callidus_Plan_Assignable__c p:tPlanAssign)
		{
			System.assertEquals(planObj.id, p.Plan__c);
		}
        
        ApexPages.StandardController mc = new Apexpages.Standardcontroller(planObj);
        Cald_EditPlanEligibilityVF ep = new Cald_EditPlanEligibilityVF(mc);
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.cancelEligibility());
        system.assertEquals(null, ep.checkSelection());
        
        system.assertEquals(ep.rolesList, ep.getRoleRows());
        system.assertEquals(ep.titlesList, ep.getTitleRows());
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.cancelEligibility());
        system.assertEquals(null, ep.checkSelection());
        
        system.assertEquals(ep.rolesList, ep.getRoleRows());
        system.assertEquals(ep.titlesList, ep.getTitleRows());
        
        system.assertEquals(null, ep.saveEligibility());
        system.assertEquals(null, ep.updateParticipants());
        system.assertEquals(null, ep.removeEligibility());
        system.assertEquals('success', ep.changeTC());
        
        Test.stopTest();
    }

    static testMethod void testCald_EditPlanEligibilityVF2()
    {
        PageReference pg = Page.Cald_Edit_Plan_Eligibility;
        Test.setCurrentPage(pg);
        Test.startTest();
        Callidus_Plan__c planObj = new Callidus_Plan__c(Name = 'Test2', Start_Date__c = Date.today(), End_Date__c = (Date.today() + 100), Quota__c = 1000000, Type__c = 'Title');
        insert planObj;
		List<Callidus_Plan__c> tPlan = [select Name from Callidus_Plan__c where id = :planObj.id];
		for(Callidus_Plan__c p:tPlan)
		{
			System.assertEquals('Test2', p.Name);
		}
        
        Callidus_Plan_Role__c pr = new Callidus_Plan_Role__c(plan__c = planObj.id, RoleId__c = UserInfo.getUserRoleId());
        insert pr;
		List<Callidus_Plan_Role__c> tPlanRole = [select Plan__c from Callidus_Plan_Role__c where id = :pr.id];
		for(Callidus_Plan_Role__c p:tPlanRole)
		{
			System.assertEquals(planObj.id, p.Plan__c);
		}
        
        Callidus_Plan_Assignable__c pa = new Callidus_Plan_Assignable__c(Plan__c = planObj.id, Participant__c = UserInfo.getUserId(), Role_ID__c = UserInfo.getUserRoleId(), Effective_Start_Date__c = (planObj.Start_Date__c + 5), Effective_End_Date__c = (planObj.End_Date__c - 5), Plan_Role__c = pr.id);
        insert pa;
		List<Callidus_Plan_Assignable__c> tPlanAssign = [select Plan__c from Callidus_Plan_Assignable__c where id = :pa.id];
		for(Callidus_Plan_Assignable__c p:tPlanAssign)
		{
			System.assertEquals(planObj.id, p.Plan__c);
		}
        
        ApexPages.StandardController mc = new Apexpages.Standardcontroller(planObj);
        Cald_EditPlanEligibilityVF ep = new Cald_EditPlanEligibilityVF(mc);
        mc = new Apexpages.Standardcontroller(planObj);
        ep = new Cald_EditPlanEligibilityVF(mc);
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.cancelEligibility());
        system.assertEquals(null, ep.checkSelection());
        system.assertEquals(ep.rolesList, ep.getRoleRows());
        system.assertEquals(ep.titlesList, ep.getTitleRows());
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.addEligibility());
        system.assertEquals(null, ep.cancelEligibility());
        system.assertEquals(null, ep.checkSelection());
        system.assertEquals(ep.rolesList, ep.getRoleRows());
        system.assertEquals(ep.titlesList, ep.getTitleRows());
        system.assertEquals(null, ep.saveEligibility());
        system.assertEquals(null, ep.updateParticipants());
        system.assertEquals(null, ep.removeEligibility());
        ep.planRoleList.clear();
        system.assertEquals(0, ep.planRoleList.size());
        system.assertEquals(null, ep.cancelEligibility());
        system.assertEquals(null, ep.removeEligibility());
        system.assertEquals(null, ep.updateParticipants());
        
        User[] userList = [select UserRole.Id, UserRole.Name, Title from User limit 1];
        TitleWrapper t = new TitleWrapper(0);
        system.assertNotEquals(userList[0].Title, t.getTitles().get(0).getValue());
        RoleWrapper rw = new RoleWrapper(0);
        system.assertEquals(userList[0].UserRole.id, rw.getRoles().get(0).getValue());
        Test.stopTest();
    }    
}